﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DatabaseObjectDictionary.cs" company="SmartPlan">
//   SmartPlan 2011
// </copyright>
// <summary>
//   Database ObjectDictionary
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace DbDiff.Common.Helper
{
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// Database ObjectDictionary
    /// </summary>
    [Serializable]
    public class DatabaseObjectDictionary
    {
        /// <summary>
        /// The instance.
        /// </summary>
        private static readonly DatabaseObjectDictionary instance = new DatabaseObjectDictionary();

        /// <summary>
        /// The write lock.
        /// </summary>
        private readonly object writeLock = new object();

        /// <summary>
        /// Initializes a new instance of the <see cref="DatabaseObjectDictionary"/> class. 
        /// </summary>
        public DatabaseObjectDictionary()
        {
            lock (this.writeLock)
            {
                this.ObjectTypesI = new Dictionary<DatabaseObjectTypes, string>();

                foreach (string value in Enum.GetNames(typeof(DatabaseObjectTypes)))
                {
                    this.ObjectTypesI.Add((DatabaseObjectTypes)Enum.Parse(typeof(DatabaseObjectTypes), value), value);
                }
            }
        }

        /// <summary>
        /// Gets ObjectTypesI.
        /// </summary>
        public Dictionary<DatabaseObjectTypes, string> ObjectTypesI { get; private set; }

        /// <summary>
        /// Gets ObjectTypes.
        /// </summary>
        public static Dictionary<DatabaseObjectTypes, string> ObjectTypes
        {
            get { return instance.ObjectTypesI; }
        }
    }
}